Return to doc.sitecore.com

Valid for Sitecore 5.2, 5.1.1
  Changing an Item's Template
Prev Next

Sitecore allows users to change the template that a specific item is based on.  This is akin to moving a record from one table in an RDBMS to another table, or changing the class of an object in an object oriented system. 

When an item’s template changes, Sitecore changes the item’s template ID field but otherwise maintains the ItemDefinition as is.  Data associated with fields that have identical field names in both templates is maintained (although the field IDs are changed).  Other field data is discarded.

To support changing templates, the data provider must implement the method listed below.

Return Value

Method Name

Parameters

Description

bool

ChangeTemplate

ItemDefinition item
TemplateChangeList changes
CallContext context

Changes the templateID and fieldIDs based on the information provided in changes.  Data that cannot be transferred to new fields is discarded.  Returns True if the operation is successful, False otherwise.


Prev Next